#ifndef SunWindowSystem_First
#define SunWindowSystem_First
#ifdef __GNUG__
#pragma interface
#endif

#include "WindowSystem.h"

#define MAXPENS 32

struct pixrect;
struct pixfont;
struct fullscreen_t;

class SunWindowPort;
class SunColorMap;

//---- SunWindowSystem ---------------------------------------------------------

class SunWindowSystem: public WindowSystem {
public:
	MetaDef(SunWindowSystem);
	SunWindowSystem();
	~SunWindowSystem();
	bool Init0();

	bool Notify();
	WindowPort *MakeWindow(Window *bw, WindowType wt, GrCursor curs);
	FontManager *MakeFontManager();
	DevBitmap *MakeDevBitmap(Point sz, u_short *data, u_short depth, bool freedata, u_short pad);
	VObject *MakeWindowBorder(WindowType wt, VObject *in,
										char *title, bool block, bool fixed);
	IACImpl *MakeRpcImpl(IAC *sc);

	//---- Clipboard
	void DevCheckSelection();
	int DevHaveSelection(Data *data);

	//---- Drag & Drop
	int DevDragDrop(int code, int winid, const Point &globalpos, Rectangle *droprect);
	int DevFindWindow(const Point &p);
	bool DevIsEtWindow(int winid);

	static void Use();

public:
	static int parentNo;
	static int rootFd;
	static SunWindowPort *overlayport;
	static pixfont *cursors;
	static fullscreen_t *FS;
	static pixrect *tmppr, *tmppr2;
	static pixrect *pens[MAXPENS];

private:
	u_long scrapModTime;
};

extern int findpr(char type, pixrect **pr, int wd, int ht, int k1, int k2, int k3);

#endif
